<template>
  <div id="app">
    <el-container>
      <el-header>
        <div class="header-content">
          <div>
            <h1>大文件上传系统</h1>
            <p>支持断点续传、秒传、进度显示、暂停/恢复 | 多存储策略支持</p>
          </div>
          <div class="header-controls">
            <div class="upload-mode-switch">
              <el-radio-group v-model="uploadMode" @change="handleModeChange">
                <el-radio-button label="single">单文件上传</el-radio-button>
                <el-radio-button label="multi">多文件上传</el-radio-button>
              </el-radio-group>
            </div>
            <el-button 
              type="primary" 
              @click="showStoragePanel = !showStoragePanel"
              :icon="showStoragePanel ? 'Hide' : 'Setting'"
            >
              {{ showStoragePanel ? '隐藏' : '存储' }}设置
            </el-button>
          </div>
        </div>
      </el-header>
      <el-main>
        <div class="main-content">
          <!-- 存储策略面板 -->
          <el-aside v-show="showStoragePanel" width="300px" class="storage-aside">
            <StorageSelector />
          </el-aside>
          
          <!-- 上传区域 -->
          <div class="upload-content" :class="{ 'with-storage': showStoragePanel }">
            <FileUploader v-if="uploadMode === 'single'" />
            <MultiFileUploader v-if="uploadMode === 'multi'" />
          </div>
        </div>
      </el-main>
    </el-container>
  </div>
</template>

<script>
import { ref } from 'vue'
import FileUploader from './components/FileUploader.vue'
import MultiFileUploader from './components/MultiFileUploader.vue'
import StorageSelector from './components/StorageSelector.vue'

export default {
  name: 'App',
  components: {
    FileUploader,
    MultiFileUploader,
    StorageSelector
  },
  setup() {
    const uploadMode = ref('single')
    const showStoragePanel = ref(false)

    const handleModeChange = (mode) => {
      console.log('切换上传模式:', mode)
    }

    return {
      uploadMode,
      showStoragePanel,
      handleModeChange
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

.el-header {
  background-color: #409EFF;
  color: white;
  padding: 0 20px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.el-header h1 {
  margin: 0;
  font-size: 24px;
}

.el-header p {
  margin: 5px 0 0 0;
  font-size: 14px;
  opacity: 0.8;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.upload-mode-switch {
  margin-right: 8px;
}

.main-content {
  display: flex;
  height: 100%;
  gap: 16px;
}

.storage-aside {
  height: fit-content;
  transition: all 0.3s ease;
}

.upload-content {
  flex: 1;
  transition: all 0.3s ease;
}

.upload-content.with-storage {
  margin-left: 0;
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    justify-content: center;
    gap: 10px;
  }
  
  .el-header {
    height: auto;
    padding: 15px 20px;
  }
  
  .el-header h1 {
    font-size: 20px;
  }
  
  .main-content {
    flex-direction: column;
  }
  
  .storage-aside {
    width: 100% !important;
    margin-bottom: 16px;
  }
}

.el-main {
  background-color: #f5f7fa;
  min-height: calc(100vh - 60px);
  padding: 20px;
}
</style> 